package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class demo5 {
	public static void main(String[] args) throws IOException {
		FileOutputStream fos=new FileOutputStream("E:\\javacode\\111\\src\\io\\aa.txt");
		FileInputStream fis = new FileInputStream("C:\\Users\\THINK\\Desktop\\ps.txt");
		/*
		 * int a=0; while ((a=fis.read())!=-1) { fos.write(a);
		 * 
		 * }
		 */
		//使用数组缓冲流，读写多个字节速度变快
		byte[] bytes =new byte[1024];
		int len=0;//每次读取的有效字节个数
		while ((len=fis.read(bytes))!=-1) {
			fos.write(bytes,0,len);
		}
		fos.close();
		fis.close();
	}
}
